package com.ruoyi.app.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.wuliu.domain.TCorporation;
import com.ruoyi.web.wuliu.service.ITCorporationService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 物流设备Controller
 * 
 * @author ruoyi
 * @date 2023-12-20
 */
@Api(tags = "小程序端-物流设备")
@RestController
@RequestMapping("/app/corporation")
public class AppTCorporationController extends BaseController
{
    @Autowired
    private ITCorporationService tCorporationService;

    /**
     * 查询物流设备列表
     */
    @ApiOperation("查询物流设备列表")
    @GetMapping("/list")
    public TableDataInfo list(TCorporation tCorporation)
    {
        startPage();
        List<TCorporation> list = tCorporationService.selectTCorporationList(tCorporation);
        return getDataTable(list);
    }

    /**
     * 获取物流设备详细信息
     */
    @ApiOperation("获取物流设备详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(tCorporationService.selectTCorporationById(id));
    }

    /**
     * 新增物流设备
     */
    @ApiOperation("新增物流设备")
    @PostMapping
    public AjaxResult add(@RequestBody TCorporation tCorporation)
    {
        return toAjax(tCorporationService.insertTCorporation(tCorporation));
    }

    /**
     * 修改物流设备
     */
    @ApiOperation("修改物流设备")
    @Log(title = "物流设备", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TCorporation tCorporation)
    {
        return toAjax(tCorporationService.updateTCorporation(tCorporation));
    }

    /**
     * 删除物流设备
     */
    @ApiOperation("删除物流设备")
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(tCorporationService.deleteTCorporationByIds(ids));
    }
}
